<?php  namespace Common\Model;

use Think\Model;

class BaseModel extends  Model
{
    public function store($data)
    {
    if($this->create($data)){

    $action = isset($data[$this->pk])? 'save':'add';

    $res = $this->$action($data);

    return['valid'=>'success','msg'=>'操作成功','$data'=>$res];
    }else{
    return['valid'=>'failed','msg'=>$this->getError()];

    }


    }



}